<template>
	<view class="cu-card case">
		<view class="cu-item shadow" v-for="(item, index) in dataList" :key="index">
			<view class="text-content">投诉编号:{{item.COMPLAINT_ID}}</view>
			<view class="text-content">{{item.CONTENT.substring(0,30)}}</view>
			<view>
				<view class="text-gray text-sm flex justify-between" v-if="item.STATE=='-1'">{{item.CREATETIME}}</view>
				<view class="text-red text-sm flex justify-between" v-if="item.STATE!='-1'">已处理</view>
				<navigator class="navigatior-view" :url="'complainDetail?complainId='+item.COMPLAINT_ID">
					<view class="text-detail">查看详情>></view>
				</navigator>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				dataList:[],
				userId:''
			}
		},
		onLoad(option) {
			this.userId = option.userId;
			this.getDataList();
		},
		methods: {
			getDataList() {
				uni.showLoading({
					title: '加载中...',
					mask: false
				});
				console.log(this.websiteUrl + 'appim/getComplaints')
				uni.request({
					url: this.websiteUrl + 'appim/getComplaints',
					method: 'GET',
					data: {"USERID" : this.userId},
					success: res => {
						if (res.statusCode == 200) {
							var data = res.data.data;
							this.dataList = this.dataList.concat(data);
						} else {
							uni.showToast({
								title:res.errMsg
							})
						}
					},
					fail: () => {},
					complete: () => {
						uni.hideLoading();
					}
				});
			}
		},
	}
</script>

<style>
	.text-content {
		margin-bottom: 10px;
		font-size: 14px;
		border-bottom: 1px solid #eee;
		padding-bottom: 10px;
	}
	.cu-card>.cu-item {
		margin: 10px 0px;
		border-radius: 0;
		padding: 15px;
	}
	.text-sm {
		display: inline-block;
	}
	.navigatior-view {
		display: inline-block;
		float: right;
	}
	.text-detail {
		color: #19c99a;
	}
	
</style>
